<layout name="Layout/layout" />
<div class="row">
	<div class="col-lg-12">
		<h1 class="page-header">IP</h1>
	</div>
	<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				分配IP
			</div>
			<!-- /.panel-heading -->
			<div class="panel-body">
				<?php 
					foreach($now as $k=>$v){
						?>
						<div class="panel panel-default">
							<div class="panel-heading">用户：{:getUsernameById($k)}</div>
							<div class="panel-body">
								<form role="form" action="{:U('Admin/Ip/allotHandle')}" method="post">
									<input type="hidden" name="uid" value="{$k}">
									<div class="form-group">
										<label>选择权限：</label><br />
									<?php
										foreach($iplist as $vo){
											?>
											<label class="checkbox-inline">
												<input name="ips[]" type="checkbox" value="{$vo['id']}" {:ipcheck($k, $vo['id'])}> {$vo['name']}
											</label>	
											<?php
										}
									?>
									</div>
									<button type="submit" class="btn btn-default">保存</button>
								</form>
							</div>
						</div>
						<?php
					}
				?>
				<hr />
				<form role="form" action="{:U('Admin/Ip/allotHandle')}" method="post">
					<div class="form-group">
						<label>选择一个新用户</label>
						<select name="uid" class="form-control">
							<foreach name="userlist" item="v">
								<option value="{$v['id']}">{$v['username']}--{$v['name']}</option>
							</foreach>
						</select>
						
					</div>
					<div class="form-group">
						<label>选择权限：</label><br />
						<foreach name="iplist" item="v">
							<label class="checkbox-inline">
								<input name="ips[]" type="checkbox" value="{$v['id']}"> {$v['name']}
							</label>	
						</foreach>
					</div>
					<button type="submit" class="btn btn-default">新增</button>
				</form>
			</div>
			<!-- /.panel-body -->
		</div>
		<!-- /.panel -->
	</div>
	<!-- /.col-lg-12 -->
</div>